package com.zondy.mapgis.android.frag;


import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.zondy.mapgis.android.activity.FeedbackActivity;
import com.zondy.mapgis.android.activity.LocationTransActivity;
import com.zondy.mapgis.android.activity.MapActivity;
import com.zondy.mapgis.android.activity.MyTracksActivity;
import com.zondy.mapgis.android.base.BaseFragment;
import com.zondy.mapgis.android.model.AndroidShare;
import com.zondy.mapgis.explorer.MapApplication;
import com.zondy.mapgis.explorer.R;

public class AccountFrag extends BaseFragment implements OnClickListener
{
	
    private String TAG = this.getClass().getSimpleName();
	private MapActivity mMapActivity = null;
	
	private ImageView mTileBack = null; 
	

	@Override
	public int bindLayout()
	{
		return R.layout.mimepage_layou_frag;
	}

	@Override
	public void initView(View view)
	{
		view.findViewById(R.id.tracks_view_txt).setOnClickListener(this);
		view.findViewById(R.id.my_feedback_txt).setOnClickListener(this);
		view.findViewById(R.id.mine_share_txt).setOnClickListener(this);
		view.findViewById(R.id.location_trans_tv).setOnClickListener(this);
		
		mTileBack = (ImageView) view.findViewById(R.id.title_back);
		mTileBack.setOnClickListener(this);
	}

	@Override
	public void doBusiness(Context mContext)
	{
		mMapActivity = MapApplication.getApp().getMapActivity();
		
	}

	@Override
	public void onClick(View v)
	{
		switch (v.getId())
		{
		case R.id.my_feedback_txt:
			startActivity(new Intent(getContext(), FeedbackActivity.class));
			break;

		case R.id.mine_share_txt:
			AndroidShare share = new AndroidShare(getContext(), "heiheihei", "http://ww1.sinaimg.cn/large/bca0b9cfjw1dz9h6ufo8dj.jpg");
			share.show();
			break;
		case R.id.tracks_view_txt:
			mMapActivity.startActivityForResult(new Intent(getContext(), MyTracksActivity.class), mMapActivity.TracksRequestCode);
//			mMapActivity.removeFragment(TAG, null);
//			startActivity(new Intent(getApplicationContext(), MyTracksActivity.class));
			break;
		case R.id.location_trans_tv:
			startActivity(new Intent(getActivity(), LocationTransActivity.class));
			break;
		case R.id.title_back:
			mMapActivity.removeFragment(TAG, null);
			break;
		default:
			break;
		}
	}

	@Override
	public boolean goback()
	{
		return false;
	}

	@Override
	public boolean isLocked()
	{
		return false;
	}

	@Override
	public String getName()
	{
		return TAG;
	}
	
	


}
